import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.net.URL;

public class Main {
    public static void main(String[] args) {
        //序列化：将address，转为二进制并进行保存
        //对象的状态信息转换为可以存储或传输的形式的过程
        MyClass address = new MyClass();
        address.setStreet("wall street");
        try {
            FileOutputStream fout = new FileOutputStream("address.txt");
            ObjectOutputStream oos = new ObjectOutputStream(fout);
            oos.writeObject(address);
            oos.close();
            System.out.println("Done");
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
